package com.itcat.api;/*
 * @Author: gonhsl
 * @Date:2022-04-04-16:34
 * */

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.itcat.api.mysql.SmsCouponHistoryApi;
import com.itcat.mapper.SmsCouponHistoryMapper;
import com.itcat.mysql.pojo.SmsCouponHistory;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

@DubboService
public class SmsCouponHistoryApiImpl implements SmsCouponHistoryApi {
    @Autowired
    private SmsCouponHistoryMapper smsCouponHistoryMapper;
    @Override
    public Page<SmsCouponHistory> list(Integer pageNum, Integer pageSize, Integer couponId, String orderSn, Integer useStatus) {
        LambdaQueryWrapper<SmsCouponHistory> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(couponId!=null,SmsCouponHistory::getCouponId,couponId)
                .eq(orderSn!=null,SmsCouponHistory::getOrderSn,orderSn)
                .eq(useStatus!=null,SmsCouponHistory::getUseStatus,useStatus);
        Page<SmsCouponHistory> page = new Page<>(pageNum,pageSize);
       return smsCouponHistoryMapper.selectPage(page,wrapper);
    }
}
